package cn.edu.flink.scala.tutorial.wordcount.source

import org.apache.flink.streaming.api.functions.source.SourceFunction

class WordCountSourceFunction extends SourceFunction[String] {
  override def run(ctx: SourceFunction.SourceContext[String]): Unit = {
    while (true) {
      ctx.collect("hello scala")
      ctx.collect("hello Java")
      ctx.collect("hello Flink")
      Thread.sleep(3000L)
    }
  }

  override def cancel(): Unit = {

  }
}


object WordCountSourceFunction {
  def apply(): WordCountSourceFunction = new WordCountSourceFunction()
}
